<!doctype html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head>
    <meta name="referrer" content="no-referrer" />
    <link rel="stylesheet" th:href="@{${baseLink} + '/source/js/bootstrap-3.3.7/css/bootstrap.min.css'}" type="text/css">
    <link rel="stylesheet" th:href="@{${baseLink} + '/source/css/reset.css'}" type="text/css">
    <link rel="stylesheet" th:href="@{${baseLink} + '/source/css/bootstrap-grid.min.css'}" type="text/css">
    <link rel="stylesheet" th:href="@{${baseLink} + '/source/css/animations.css'}" type="text/css">
    <link rel="stylesheet" th:href="@{${baseLink} + '/source/css/perfect-scrollbar.css'}" type="text/css">
    <link rel="stylesheet" th:href="@{${baseLink} + '/source/css/owl.carousel.css'}" type="text/css">
    <link rel="stylesheet" th:href="@{${baseLink} + '/source/css/magnific-popup.css'}" type="text/css">
    <link rel="stylesheet" th:href="@{${prefix} + '/source/css/main.css'}" type="text/css">
    <link rel="stylesheet" th:href="@{${baseLink} + '/source/js/highlightjs/styles/github-gist.css'}"/>
    <link rel="stylesheet" th:href="@{${baseLink} + '/source/js/fancybox/jquery.fancybox.min.css'}"/>
    <link rel="stylesheet" th:href="@{${baseLink} + '/source/fonts/font-awesome/css/font-awesome.min.css'}" />
    <style>
        body {
            background: #fff;
            overflow: auto;
        }

        #blog-container {
            padding: 30px 60px;
        }

        @media (max-width: 767px) {
            #blog-container {
                padding: 30px;
            }
        }

        a {
            color: #222;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            text-decoration: none;
        }

        a:hover {
            text-decoration: none !important;
            color: #09aeea;
        }
    </style>
</head>
<body>
<div id="blog-container">
    <!-- Loading animation -->
    <div class="preloader">
        <div class="preloader-animation">
            <div class="preloader-spinner">
            </div>
        </div>
    </div>
    <!-- /Loading animation -->
    <div layout:fragment="content" ></div>
</div>
<script th:src="@{${baseLink} + '/source/js/jquery-2.1.3.min.js'}"></script>
<script th:src="@{${baseLink} + '/source/js/fancybox/jquery.fancybox.min.js'}"></script>
<script th:inline="javascript">
    $(function () {
        $(window).on('load', function() {
            $(".preloader").fadeOut(700, "linear");
        });
    });
</script>
<span th:if="${isDetail}">
    <script th:src="@{${baseLink} + '/source/js/fancybox/jquery.fancybox.min.js'}"></script>
    <script type='text/javascript' th:src="@{${baseLink} + '/source/js/overshare/js/social-share.min.js'}"></script>
    <script type='text/javascript' th:src="@{${baseLink} + '/source/js/highlightjs/highlight.pack.js'}"></script>
    <script type='text/javascript' th:src="@{${baseLink} + '/source/js/layer/layer.js'}"></script>
    <script type='text/javascript' th:inline="javascript">

        document.addEventListener('DOMContentLoaded', function() {
            document.querySelectorAll('figure span').forEach(function(block) {
                hljs.highlightBlock(block);
            });
        });

        $("#priseBtn").on("click",function () {
            let postId = $(this).data("id");
            let key = "post-hasPrize" + postId;
            if (sessionStorage.getItem(key)) {
                layer.msg("已点赞");
                return;
            }

            $.post("/praisePost/" + postId, null, function (resp) {
                if (resp.success) {
                    $("#prizeCount").text(resp.data);
                    sessionStorage.setItem(key, "y");
                    layer.msg("谢谢点赞");
                }
            },"json");

        });

        let baseLink = [[${baseLink}]];
        let imgs = $("img.lazyload");
        for (let i = 0; i < imgs.length; i++) {
            let $img = $(imgs[i]);
            $img.attr("src", $img.data("original"));
        }

        if (window.parent == window) {
            let protocol = window.location.protocol;
            let host = window.location.host;
            let pathname = window.location.pathname;
            window.parent.location.href = protocol + "//" + host + "#" + pathname;
        }
    </script>
</span>
</body>
</html>